/*
 * @lc app=leetcode.cn id=27 lang=javascript
 *
 * [27] 移除元素
 */

// @lc code=start
/**
 * @param {number[]} nums
 * @param {number} val
 * @return {number}
 */
var removeElement = function (nums, val) {
  for (let index = 0; index < l; index++) {
    const element = array[index];
    if (element === val) {
      nums.splice(index, 1);
      index--;
    }
  }
};
// @lc code=end

var removeElement2 = function (nums, val) {
  let i = 0;
  for (let index = 0; index < nums.length; index++) {
    const element = nums[index];
    if (element !== val) {
      nums[i] === nums[index];
      i++;
    }
  }

  return i;
};
